package com.sgb.kjwl.view.ui.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.ArrayList;

public class FragPagerAdapter extends FragmentStatePagerAdapter {

    private ArrayList<Fragment> fragments;
    private String[] titles;

    public FragPagerAdapter(@NonNull FragmentManager fm, ArrayList<Fragment> fragments, String[] mTitles) {
        super(fm);
        this.fragments = fragments;
        this.titles = mTitles;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public String getPageTitle(int position) {
        return titles[position];
    }
}
